using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using IGlobalist.Cms.Common;
using IGlobalist.Cms.Bll;
using IGlobalist.Cms.Model;
using System.Collections.Generic;

namespace IGlobalist.Cms.Admin
{
    public partial class PageManagement : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ucPageTree.BindPage();
                ucActionBar.ObjectTypeCurrent = CmsObjectType.Page;
                ucActionBarBottom.ObjectTypeCurrent = CmsObjectType.Page;
            }
            ucPageTree.SelectedPageChanged += ucPageAddEdit.DoBindPage;
            ucPageTree.SelectedPageChanged += ucPageAddEdit.DoShow;
            ucPageTree.SelectedPageChanged += ucContentListView.DoHidden;
            ucPageTree.SelectedPageChanged += ucContentView.DoHidden;
            ucPageTree.SelectedPageChanged += HiddenInfo;
            ucPageTree.SelectedPageChanged += ucActionBar.DoListEditClick;
            ucPageTree.SelectedPageChanged += ucActionBarBottom.DoListEditClick;


            ucPageAddEdit.ViewContent += ucContentListView.DoBindContent;
            ucPageAddEdit.ViewContent += ucContentListView.DoShow;
            ucPageAddEdit.ViewContent += ucPageAddEdit.DoHidden;
            ucPageAddEdit.ViewContent += HiddenInfo;

            ucContentListView.EditContent += ucContentView.DoBindContent;
            ucContentListView.EditContent += ucContentView.DoShow;
            ucContentListView.EditContent += ucContentListView.DoHidden;


            if (ucContentView.Visible == true)
            {
                ucActionBar.SaveButtonClick += ucContentView.DoSaveContent;
                ucActionBar.SaveButtonClick += ucContentListView.DoShow;
                ucActionBar.SaveButtonClick += ucContentView.DoHidden;
                ucActionBar.SaveButtonClick += ucActionBar.DoEditClassClick;
                ucActionBarBottom.SaveButtonClick += ucContentView.DoSaveContent;
                ucActionBarBottom.SaveButtonClick += ucContentListView.DoShow;
                ucActionBarBottom.SaveButtonClick += ucContentView.DoHidden;
                ucActionBarBottom.SaveButtonClick += ucActionBarBottom.DoEditClassClick;
                ucActionBar.SaveButtonClick += ucActionBarBottom.DoEditClassClick;
                ucActionBarBottom.SaveButtonClick += ucActionBar.DoEditClassClick;
            }

            ucContentView.SaveContent += ucContentView.DoHidden;
            ucContentView.SaveContent += ucContentListView.DoShow;

            ucActionBar.DeleteButtonClick += ucPageAddEdit.DoDeletePage;
            ucActionBar.DeleteButtonClick += ucActionBarBottom.DoEditClassClick;
            ucActionBarBottom.DeleteButtonClick += ucPageAddEdit.DoDeletePage;
            ucActionBar.DeleteButtonClick += ucActionBar.DoEditClassClick;
            ucActionBarBottom.DeleteButtonClick += ucActionBarBottom.DoEditClassClick;
            ucActionBarBottom.DeleteButtonClick += ucActionBar.DoEditClassClick;

          
           

            if (ucPageAddEdit.Visible == true)
            {
                ucActionBar.SaveButtonClick += ucPageAddEdit.DoSave;
                ucActionBarBottom.SaveButtonClick += ucPageAddEdit.DoSave;
            }

            ucActionBar.NewButtonClick += ucPageAddEdit.DoNew;
            ucActionBar.NewButtonClick += HiddenInfo;
            ucActionBar.NewButtonClick += ucContentView.DoHidden;
            ucActionBar.NewButtonClick += ucContentListView.DoHidden;
            ucActionBar.NewButtonClick += ucPageAddEdit.DoShow;
            ucActionBar.NewButtonClick += ucActionBarBottom.DoEditClassClick;

            ucActionBarBottom.NewButtonClick += ucPageAddEdit.DoNew;
            ucActionBarBottom.NewButtonClick += ucContentView.DoHidden;
            ucActionBarBottom.NewButtonClick += ucContentListView.DoHidden;
            ucActionBarBottom.NewButtonClick += HiddenInfo;
            ucActionBarBottom.NewButtonClick += ucPageAddEdit.DoShow;
            ucActionBarBottom.NewButtonClick += ucActionBar.DoEditClassClick;
            


            ucPageAddEdit.SavePage += ucPageTree.BindTree;
            ucPageAddEdit.DeletePage += ucPageTree.BindTree;

            ucContentListView.EditContent += ucActionBar.DoListEditClick;

        }
        public void HiddenInfo(object sender, EventArgs e)
        {
            pnlInfo.Visible = false;
        }
    }
}
